Embedding DjVu in HTML Pages

Embedding a document displays it as part of a larger HTML page and does not require that the Web server support the DjVu MIME type. The control itself is exposed to JScript/VBScript (Internet Explorer only).

Basics

To embed a DjVu document within an HTML page, you can use either the HTML <object> or <embed> tag. The tags you use to embed documents depend on the browser your users will use to view them. Internet Explorer on Window platforms supports both the object tag and the embed tag. It supports the former better than the latter. All other platforms support only the embed tag.

Examples

Each of the examples below renders the DjVu file "foo.djvu" (assumed to be in the same directory as the HTML file) at 100% width and height. If all you want to do is show the DjVu file, then use one of these as a template.

<embed>

<embed type=“image/vnd.djvu” SRC=“filename.djvu” width=“100%” height=“100%”></embed>

<object>

<object classid=”clsid:0e8d0700-75df-11d3-8b4a-0008c7450c4a” width=”100%” height=”100%”>

    <param name=”src” value=”foo.djvu”>

</object>

Nesting the <embed> Inside the <object>

<object classid=”clsid:0e8d0700-75df-11d3-8b4a-0008c7450c4a” width=”100%” height=”100%”>

    <param name=”src” value=”foo.djvu”>

       <embed type=”image/vnd.djvu” src=”foo.djvu” width=”100%” height=”100%”>

       </embed>

</object>

Setting Properties, Calling Methods, Trapping Events

In the examples above, the only property of the control that we set was SRC. In the examples below we exercise some of the others.

Setting Initial Zoom and Rotate With an Object Tag

<object classid="clsid:0e8d0700-75df-11d3-8b4a-0008c7450c4a" width="100%" height="100%">

  <PARAM NAME="src" VALUE="http://server/path/welcome.djvu">

  <PARAM NAME="rotate" VALUE="90">

  <PARAM NAME="zoom" VALUE="300">

</object>

Setting Initial Zoom and Rotate with an Embed Tag

<EMBED src="http://server/path/welcome.djvu" TYPE="image/vnd-djvu" width="100%" height="100%" rotate=90 zoom=300>

</EMBED>

Trapping an Event and Calling a Method in Internet Explorer

This example highlights every occurance of the term "DjVu" in a multipage document. It works by trapping the PageChange event and then calling the HighlightTerms method.

<object ID=myDjVu classid="clsid:0e8d0700-75df-11d3-8b4a-0008c7450c4a" width="100%" height="100%">

  <PARAM NAME="src" VALUE="http://server/path/welcome.djvu">

</object>

 

<SCRIPT FOR=myDjVu EVENT="PageChange(newpage)" LANGUAGE="JScript"> myDjVu.HighlightTerm("DjVu", 0,0,1, "&Hfe980b");

</SCRIPT>

Automatic Installation (Internet Explorer Only)

A very light-weight distribution of the control is available from Lizardtech's website. This CAB archive is designed to be used with Internet Explorer's Internet Component Download mechanism. If you reference this archive from the "codeBase" attribute of the OBJECT tag, then if the user does not have the control installed, he will be prompted to install it.

Example

<object style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" codeBase="DjVuControlLite_EN.cab#Version=6,0,0,500" classid="clsid:0e8d0700-75df-11d3-8b4a-0008c7450c4a" width="100%" height="100%" BORDER="0">

  <PARAM NAME="src" VALUE="http://www.lizardtech.com/plugins/en_US/welcome.djvu">

</object>

For more details see http://msdn.microsoft.com/workshop/delivery/download/overview/overview.asp.

Notes

The version attribute is optional. It corresponds to the version of the control.

The "Lite" cab archives contain a single localization only. If the target system is configured for a locale other than the one that is installed, the control will fail to instantiate.

The Lite cab archives do not contain Help. User's requests for help will be directed to the online help posted on the LizardTech website.